function uploadDoc(){
	var doc = document.getElementById('doc').value;
	var isExistSmall = checkDoc(doc);
	var canUpload = true;
	if(doc == ''){
		PigossMsg.alert('请选择一个文档!');
		canUpload = false;
	}
	if(!isExistSmall){
		PigossMsg.alert('上传文档的类型不符合上传的规则！');
		canUpload = false;
	}
	if(canUpload){
		//document.getElementById("uploadDoc").action='/upload_doc.action?id='+id+'&fileName='+fileName+'&fileType='+type;
		document.charset='utf-8';
		document.getElementById("uploadDoc").submit();
		PigossMsg.alert("上传成功！");
		imgCloseShow();
	};  			
};


//检查文档格式是否合法
function checkDoc(file){
	var isImage = false;
	var type = file.substr(file.lastIndexOf(".")).toLowerCase();
	if(type == '.doc' || type == '.docx' || type == '.xls' || type == '.xlsx' || type == '.ppt' || type == '.pptx' || type == '.pdf'){
		isImage = true;
	}
	return isImage;
};


//onchange
function checkBeforeOfUploadOrImport(file,type,DIVID,file2){
	if(file2 == undefined){
		file2 = '';
	}
	var fileName = document.getElementById(file).value;
	var typeOfFile = fileName.substr(fileName.lastIndexOf(".")).toLowerCase();
	if(type == 'application'){
		if(typeOfFile == '.doc' || typeOfFile == '.docx' || typeOfFile == '.xls' || typeOfFile == '.xlsx' || typeOfFile == '.pdf'|| typeOfFile == '.ppt'|| typeOfFile == '.pptx'){
			if(file2 != ''){
				var fileName2 = document.getElementById(file2).value;
				if(fileName2 != ''){
					var typeOfFile2 = fileName2.substr(fileName2.lastIndexOf(".")).toLowerCase();
					if(typeOfFile2 == '.doc' || typeOfFile2 == '.docx' || typeOfFile2 == '.xls' || typeOfFile2 == '.xlsx' || typeOfFile2 == '.pdf'|| typeOfFile == '.ppt'|| typeOfFile == '.pptx'){
						$(DIVID).style.display = 'none';
					}else{
						$(DIVID).style.display = 'block';
						$(DIVID).innerHTML = "<font color=red>"+Uploader.checkFailedHint.replace("${0}",".doc ,.docx ,.xls ,.xlsx ,.pdf,.ppt,.pptx")+typeOfFile2+"</font>";
					}
				}
			}
		}else{
			$(DIVID).style.display = 'block';
			$(DIVID).innerHTML = "<font color=red>"+Uploader.checkFailedHint.replace("${0}",".jpg ,.gif ,.bmp ,.png ,.jpeg")+typeOfFile+"</font>";
		}
	}else if(type == '.image'){
		if(typeOfFile == '.jpg' || typeOfFile == '.jpeg' || typeOfFile == '.png' || typeOfFile == '.gif' || typeOfFile == '.bmp' ){
			$(DIVID).style.display = 'none';
		}else{
			$(DIVID).style.display = 'block';
			$(DIVID).innerHTML = "<font color=red>"+Uploader.checkFailedHint.replace("${0}",".txt")+typeOfFile+"</font>";
		}
	}/*else if(type == 'Excel'){
		if(typeOfFile == '.xls' || typeOfFile == '.xlsx'){
			$(DIVID).style.display = 'none';
		}else{
			$(DIVID).style.display = 'block';
			$(DIVID).innerHTML = "<font color=red>"+Uploader.checkFailedHint.replace("${0}",".xls,.xlsx")+typeOfFile+"</font>";
		}
	}*/
} 